import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from "path";
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
    //设置的别名 
    resolve: {
      // 如果报错__dirname找不到，需要安装node,
      // 执行npm i @types/node --save-dev
      alias: {
        '@': path.resolve(__dirname, "./src"),
        "@assets": path.resolve(__dirname, "./src/assets"),
        "@common": path.resolve(__dirname, "./src/common"),
        "@utils": path.resolve(__dirname, "./src/utils"),
        "@components": path.resolve(__dirname, "./src/components"),
        "@views": path.resolve(__dirname, "./src/views"),
        "@styles": path.resolve(__dirname, "./src/styles"),
      },
    },
    // css 处理
  css:{
    preprocessorOptions: {
            scss: {
                /* .scss全局预定义变量，引入多个文件 以;(分号分割)*/
                additionalData: `@import "./src/styles/css/global.scss";`,
            },
        },
  },
  server:{
    host:'0.0.0.0'
  }
})
